package com.sunyard.dal.entity;

import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.util.List;

@Data
public class Task extends TaskKey {
    private static final long serialVersionUID = 1422820158867243656L;
    /**
     * 单个：0-未开始 1-进行中 2-成功 3-停止 4-失败
     */
    public static final Integer TASK_DEVICE_NOTSTART = 0;
    public static final Integer TASK_DEVICE_ONGOING = 1;
    public static final Integer TASK_DEVICE_SUCCESS = 2;
    public static final Integer TASK_DEVICE_STOP = 3;
    public static final Integer TASK_DEVICE_FAIL = 4;
    /**
     * 整体任务：任务状态0-未开始 1-进行中 2-停止 3-已完成且全部成功 4-已完成但全部失败 5-已完成但部分成功
     */
    public static final Integer TASK_NOTSTART = 0;
    public static final Integer TASK_ONGOING = 1;
    public static final Integer TASK_STOP = 2;
    public static final Integer TASK_SUCCESS = 3;
    public static final Integer TASK_FAIL = 4;
    public static final Integer TASK_SUCCESSORFAIL = 5;
    private String taskName;

    private Integer taskType;

    private Integer taskStatus;

    private String deviceBrand;

    private String relevantResource;

    private String deviceType;

    private String createTime;

    private String updateTime;

    private String reboot;

    private String orgId;

    private String deviceModel;

    private String createOp;

    private String bak1;

    private String bak2;

    private String bak3;

    private String taskDesc;

    private List<String> deviceSns;

    private String correAppId;

    @ApiModelProperty(value = "是否停止任务（0：是  1：否）")
    private Integer stopTask;

    private List<String> orgIds;

    private String taskStatusName;

    public String getTaskStatusName() {
        if (Task.TASK_DEVICE_NOTSTART == taskStatus) {
            return "未开始";
        } else if (Task.TASK_DEVICE_ONGOING == taskStatus) {
            return "进行中";
        } else if (Task.TASK_DEVICE_SUCCESS == taskStatus) {
            return "成功";
        } else if (Task.TASK_DEVICE_STOP == taskStatus) {
            return "停止";
        } else {
            return "失败";
        }
    }

    public void setTaskStatusName(String taskStatusName) {
        this.taskStatusName = taskStatusName;
    }

    /**
     * 是否包含子机构：0-不包含，1-包含
     */
    private Integer includeSubOrg;
    /**
     * 设备状态 0-启用，1-锁定，2-注销
     */
    private Integer deviceStatus;
    /**
     * 起始入库时间
     */
    private String startTime;
    /**
     * 末尾入库时间
     */
    private String endTime;

}